package com.rising.face.lock.synchronize;

import org.redisson.Redisson;
import org.redisson.api.RLock;
import org.redisson.config.Config;

/**
 * @Author: rising
 * @Description:
 * @Date: create in 2021/1/16 16:17
 */
public class ThreadTest {

    public static void main(String[] args) throws InterruptedException {
        Thread a = new Thread(() -> {
            System.out.println("进入---" + Thread.currentThread().getName());
            System.out.println("创建子线程");

            Thread b = new Thread(() -> {
                System.out.println("进入---" + Thread.currentThread().getName());
                System.out.println("休眠2秒，模拟业务执行");
                try {
                    Thread.sleep(2 * 1000);
                    System.out.println("业务执行完毕");
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }

            }, "子线程");
            b.setDaemon(true);
            b.start();
        }, "父线程");
        a.setDaemon(true);
        a.start();
        Thread.sleep(3 * 1000);

    }

}
